#!/bin/bash

# for testing
#exit 0;

report_fail() {
	echo $1 failed
}

echo "Configuring..."
./configure
if [ $? -ne 0 ]; then
	report_fail "Configure"
	exit 0
fi

echo "Making..."
make
if [ $? -ne 0 ]; then
	echo "make failed!"
	exit 0
fi

echo "Running app..."
#make run_server
make run_client
if [ $? -ne 0 ]; then
	report_fail "runing app"
	exit 0
fi

echo "Running tests..."
make check
if [ $? -ne 0 ]; then
	report_fail "running tests"
	exit 0
fi

echo "Cleaning up..."
make clean
if [ $? -ne 0 ]; then
	report_fail "Cleaning up"
	exit 0
fi

exit 0
